package com.reservation.enums;

/**
 * 预定状态枚举
 */
public enum ReservationStatus {
    PENDING("pending", "待确认"),
    CONFIRMED("confirmed", "已确认"),
    CANCELLED("cancelled", "已取消"),
    COMPLETED("completed", "已完成");

    private final String code;
    private final String description;

    ReservationStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static ReservationStatus fromCode(String code) {
        for (ReservationStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown reservation status code: " + code);
    }
}
